/* Copyright (c) 2025 Beijing Semidrive Technology Corporation
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef  PORTING_H
#define  PORTING_H

#include "Dem.h"
#include "__regs_base.h"
#include "Mcal_Scr.h"
#include "Mcal_MemLibc.h"
#include "Mcal_ScrBits.h"
#include "irq_num.h"
#define Eth_GetCoreID()     Mcu_GetCoreID()

#define ETH_SEC_REF_RATE    250000000u

#if defined(APB_ETNERNET1_BASE)
#define ETH1_APB_REG_BASE  APB_ETNERNET1_BASE
#else
#error No eth1 reg base.
#endif

#if defined(APB_ETNERNET2_BASE)
#define ETH2_APB_REG_BASE  APB_ETNERNET2_BASE
#else
#error No eth2 reg base.
#endif

#if defined(ENET1_SBD_INTR_NUM)
#define ETH1_SBD_INTR_IDX  ENET1_SBD_INTR_NUM
#else
#error No eth1 irq num.
#endif

#if defined(ENET2_SBD_INTR_NUM)
#define ETH2_SBD_INTR_IDX  ENET2_SBD_INTR_NUM
#else
#error No eth2 irq num.
#endif

#define MTL_QUEUE_SIZE      (1024u*6u)

#define ETH_CACHEABLE_NEEDED STD_ON
#define DESC_SKIP_SIZE      ((sizeof(struct dma_desc) - 16) / (64 / 8))

#define ETH_RFD_NUM_QSIZE_4096  (0x03)
#define ETH_RFA_NUM_QSIZE_4096  (0x01)

#define ETH_RFD_NUM_QSIZE_6144  (0x06)
#define ETH_RFA_NUM_QSIZE_6144  (0x02)

#define DWC_EQOS_NRVF       16
#define DWC_EQOS_RVFW       ((DWC_EQOS_NRVF>16) ? 5 :  \
                             (DWC_EQOS_NRVF>8) ? 4 : \
                             (DWC_EQOS_NRVF>4) ? 3 : 2)


#endif /* #ifndef  PORTING_H */
